home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-1 / Inter.Net 55-1.iso / CBuilder / Setup / BCB / data.z / lmsvc.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-09  |  13.2 KB  |  546 lines

  1. /*++ BUILD Version: 0002    // Increment this if a change has global effects
  2.  
  3. Copyright (c) 1991-1996  Microsoft Corporation
  4.  
  5. Module Name:
  6.  
  7.     lmsvc.h
  8.  
  9. Abstract:
  10.  
  11.     This file contains structures, function prototypes, and definitions
  12.     for the NetService API.
  13.  
  14. [Environment:]
  15.  
  16.     User Mode -Win32
  17.  
  18. [Notes:]
  19.  
  20.     You must include NETCONS.H before this file, since this file depends
  21.     on values defined in NETCONS.H.
  22.  
  23. --*/
  24.  
  25. /*
  26.  *      C/C++ Run Time Library - Version 9.0
  27.  *
  28.  *      Copyright (c) 1997, 1998 by Borland International
  29.  *      All Rights Reserved.
  30.  *
  31.  */
  32.  
  33. #ifndef _LMSVC_
  34. #define _LMSVC_
  35. #pragma option push -b
  36.  
  37.  
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif
  41.  
  42. //
  43. // Include the file which contains all the service name strings.
  44. //
  45.  
  46. #include <lmsname.h>
  47.  
  48.  
  49. //
  50. //  Data Structures
  51. //
  52.  
  53. typedef struct _SERVICE_INFO_0 {
  54.     LPWSTR  svci0_name;
  55. } SERVICE_INFO_0, *PSERVICE_INFO_0, * LPSERVICE_INFO_0;
  56.  
  57. typedef struct _SERVICE_INFO_1 {
  58.     LPWSTR  svci1_name;
  59.     DWORD   svci1_status;
  60.     DWORD   svci1_code;
  61.     DWORD   svci1_pid;
  62. } SERVICE_INFO_1, *PSERVICE_INFO_1, * LPSERVICE_INFO_1;
  63.  
  64. typedef struct _SERVICE_INFO_2 {
  65.     LPWSTR  svci2_name;
  66.     DWORD   svci2_status;
  67.     DWORD   svci2_code;
  68.     DWORD   svci2_pid;
  69.     LPWSTR  svci2_text;
  70.     DWORD   svci2_specific_error;
  71.     LPWSTR  svci2_display_name;
  72. } SERVICE_INFO_2, *PSERVICE_INFO_2, * LPSERVICE_INFO_2;
  73.  
  74. //
  75. // Function Prototypes
  76. //
  77.  
  78. NET_API_STATUS NET_API_FUNCTION
  79. NetServiceControl (
  80.     IN  LPCWSTR servername OPTIONAL,
  81.     IN  LPCWSTR service,
  82.     IN  DWORD   opcode,
  83.     IN  DWORD   arg,
  84.     OUT LPBYTE  *bufptr
  85.     );
  86.  
  87. NET_API_STATUS NET_API_FUNCTION
  88. NetServiceEnum (
  89.     IN  LPCWSTR     servername OPTIONAL,
  90.     IN  DWORD       level,
  91.     OUT LPBYTE      *bufptr,
  92.     IN  DWORD       prefmaxlen,
  93.     OUT LPDWORD     entriesread,
  94.     OUT LPDWORD     totalentries,
  95.     IN OUT LPDWORD  resume_handle OPTIONAL
  96.     );
  97.  
  98. NET_API_STATUS NET_API_FUNCTION
  99. NetServiceGetInfo (
  100.     IN  LPCWSTR servername OPTIONAL,
  101.     IN  LPCWSTR service,
  102.     IN  DWORD   level,
  103.     OUT LPBYTE   *bufptr
  104.     );
  105.  
  106. NET_API_STATUS NET_API_FUNCTION
  107. NetServiceInstall (
  108.     IN  LPCWSTR servername OPTIONAL,
  109.     IN  LPCWSTR service,
  110.     IN  DWORD   argc,
  111.     IN  LPCWSTR argv[],
  112.     OUT LPBYTE  *bufptr
  113.     );
  114.  
  115. //
  116. // Special Values and Constants
  117. //
  118.  
  119. //
  120. //  Bitmask and bit values for svci1_status, and svci2_status
  121. //  fields.  For each "subfield", there is a mask defined,
  122. //  and a number of constants representing the value
  123. //  obtained by doing (status & mask).
  124. //
  125.  
  126. // Bits 0,1 -- general status
  127.  
  128. #define SERVICE_INSTALL_STATE       0x03
  129. #define SERVICE_UNINSTALLED         0x00
  130. #define SERVICE_INSTALL_PENDING     0x01
  131. #define SERVICE_UNINSTALL_PENDING   0x02
  132. #define SERVICE_INSTALLED           0x03
  133.  
  134. // Bits 2,3 -- paused/active status
  135.  
  136. #define SERVICE_PAUSE_STATE              0x0C
  137. #define LM20_SERVICE_ACTIVE              0x00
  138. #define LM20_SERVICE_CONTINUE_PENDING    0x04
  139. #define LM20_SERVICE_PAUSE_PENDING       0x08
  140. #define LM20_SERVICE_PAUSED              0x0C
  141.  
  142. // Bit 4 -- uninstallable indication
  143.  
  144. #define SERVICE_NOT_UNINSTALLABLE   0x00
  145. #define SERVICE_UNINSTALLABLE       0x10
  146.  
  147. // Bit 5 -- pausable indication
  148.  
  149. #define SERVICE_NOT_PAUSABLE        0x00
  150. #define SERVICE_PAUSABLE            0x20
  151.  
  152. // Workstation service only:
  153. // Bits 8,9,10 -- redirection paused/active
  154.  
  155. #define SERVICE_REDIR_PAUSED        0x700
  156. #define SERVICE_REDIR_DISK_PAUSED   0x100
  157. #define SERVICE_REDIR_PRINT_PAUSED  0x200
  158. #define SERVICE_REDIR_COMM_PAUSED   0x400
  159.  
  160. //
  161. //  Additional standard LAN Manager for MS-DOS services
  162. //
  163.  
  164. #define SERVICE_DOS_ENCRYPTION  L"ENCRYPT"
  165.  
  166. //
  167. //  NetServiceControl opcodes.
  168. //
  169.  
  170. #define SERVICE_CTRL_INTERROGATE    0
  171. #define SERVICE_CTRL_PAUSE          1
  172. #define SERVICE_CTRL_CONTINUE       2
  173. #define SERVICE_CTRL_UNINSTALL      3
  174.  
  175. //
  176. //  Workstation service only:  Bits used in the "arg" parameter
  177. //  to NetServiceControl in conjunction with the opcode
  178. //  SERVICE_CTRL_PAUSE or SERVICE_CTRL_CONTINUE, to pause or
  179. //  continue redirection.
  180. //
  181.  
  182. #define SERVICE_CTRL_REDIR_DISK     0x1
  183. #define SERVICE_CTRL_REDIR_PRINT    0x2
  184. #define SERVICE_CTRL_REDIR_COMM     0x4
  185.  
  186. //
  187. //  Values for svci1_code, and svci2_code when status
  188. //  of the service is SERVICE_INSTALL_PENDING or
  189. //  SERVICE_UNINSTALL_PENDING.
  190. //  A service can optionally provide a hint to the installer
  191. //  that the install is proceeding and how long to wait
  192. //  (in 0.1 second increments) before querying status again.
  193. //
  194.  
  195. #define SERVICE_IP_NO_HINT          0x0
  196. #define SERVICE_CCP_NO_HINT         0x0
  197.  
  198. #define SERVICE_IP_QUERY_HINT       0x10000
  199. #define SERVICE_CCP_QUERY_HINT      0x10000
  200.  
  201. //
  202. // Mask for install proceeding checkpoint number
  203. //
  204.  
  205. #define SERVICE_IP_CHKPT_NUM        0x0FF
  206. #define SERVICE_CCP_CHKPT_NUM       0x0FF
  207.  
  208. //
  209. // Mask for wait time hint before querying again
  210. //
  211.  
  212. #define SERVICE_IP_WAIT_TIME        0x0FF00
  213. #define SERVICE_CCP_WAIT_TIME       0x0FF00
  214.  
  215. //
  216. // Shift count for building wait time _code values
  217. //
  218.  
  219. #define SERVICE_IP_WAITTIME_SHIFT   8
  220. #define SERVICE_NTIP_WAITTIME_SHIFT 12
  221.  
  222. //
  223. // Mask used for upper and lower portions of wait hint time.
  224. //
  225. #define UPPER_HINT_MASK     0x0000FF00
  226. #define LOWER_HINT_MASK     0x000000FF
  227. #define UPPER_GET_HINT_MASK 0x0FF00000
  228. #define LOWER_GET_HINT_MASK 0x0000FF00
  229. #define SERVICE_NT_MAXTIME  0x0000FFFF
  230. #define SERVICE_RESRV_MASK  0x0001FFFF
  231. #define SERVICE_MAXTIME     0x000000FF
  232.  
  233. //
  234. //  SERVICE_BASE is the base of service error codes,
  235. //  chosen to avoid conflict with OS, redirector,
  236. //  netapi, and errlog codes.
  237. //
  238. // Don't change the comments following the manifest constants without
  239. // understanding how mapmsg works.
  240. //
  241.  
  242. #define SERVICE_BASE                3050
  243. #define SERVICE_UIC_NORMAL          0
  244. /*
  245.  *  Uninstall codes, to be used in high byte of 'code' on final NetStatus,
  246.  *  which sets the status to UNINSTALLED.
  247.  */
  248.  
  249. #define SERVICE_UIC_BADPARMVAL          (SERVICE_BASE + 1)
  250. /*
  251.  * The Registry or the information you just typed includes an illegal
  252.  * value for "%1".
  253.  */
  254.  
  255. #define SERVICE_UIC_MISSPARM            (SERVICE_BASE + 2)
  256. /*
  257.  * The required parameter was not provided on the command
  258.  * line or in the configuration file.
  259.  */
  260.  
  261. #define SERVICE_UIC_UNKPARM             (SERVICE_BASE + 3)
  262. /*
  263.  * LAN Manager does not recognize "%1" as a valid option.
  264.  */
  265.  
  266. #define SERVICE_UIC_RESOURCE            (SERVICE_BASE + 4)
  267. /*
  268.  * A request for resource could not be satisfied.
  269.  */
  270.  
  271. #define SERVICE_UIC_CONFIG              (SERVICE_BASE + 5)
  272. /*
  273.  * A problem exists with the system configuration.
  274.  */
  275.  
  276. #define SERVICE_UIC_SYSTEM              (SERVICE_BASE + 6)
  277. /*
  278.  * A system error has occurred.
  279.  */
  280.  
  281. #define SERVICE_UIC_INTERNAL            (SERVICE_BASE + 7)
  282. /*
  283.  * An internal consistency error has occurred.
  284.  */
  285.  
  286. #define SERVICE_UIC_AMBIGPARM           (SERVICE_BASE + 8)
  287. /*
  288.  * The configuration file or the command line has an ambiguous option.
  289.  */
  290.  
  291. #define SERVICE_UIC_DUPPARM             (SERVICE_BASE + 9)
  292. /*
  293.  * The configuration file or the command line has a duplicate parameter.
  294.  */
  295.  
  296. #define SERVICE_UIC_KILL                (SERVICE_BASE + 10)
  297. /*
  298.  * The service did not respond to control and was stopped with
  299.  * the DosKillProc function.
  300.  */
  301.  
  302. #define SERVICE_UIC_EXEC                (SERVICE_BASE + 11)
  303. /*
  304.  * An error occurred when attempting to run the service program.
  305.  */
  306.  
  307. #define SERVICE_UIC_SUBSERV             (SERVICE_BASE + 12)
  308. /*
  309.  * The sub-service failed to start.
  310.  */
  311.  
  312. #define SERVICE_UIC_CONFLPARM           (SERVICE_BASE + 13)
  313. /*
  314.  * There is a conflict in the value or use of these options: %1.
  315.  */
  316.  
  317. #define SERVICE_UIC_FILE                (SERVICE_BASE + 14)
  318. /*
  319.  * There is a problem with the file.
  320.  */
  321.  
  322.  
  323.  
  324. //
  325. //  The modifiers
  326. //
  327.  
  328. //
  329. // General:
  330. //
  331.  
  332. #define SERVICE_UIC_M_NULL  0
  333.  
  334. //
  335. //  RESOURCE:
  336. //
  337.  
  338. #define SERVICE_UIC_M_MEMORY    (SERVICE_BASE + 20)     /* memory */
  339. #define SERVICE_UIC_M_DISK      (SERVICE_BASE + 21)     /* disk space */
  340. #define SERVICE_UIC_M_THREADS   (SERVICE_BASE + 22)     /* thread */
  341. #define SERVICE_UIC_M_PROCESSES (SERVICE_BASE + 23)     /* process */
  342.  
  343. //
  344. //  CONFIG:
  345. //
  346.  
  347. //
  348. // Security failure
  349. //
  350.  
  351. #define SERVICE_UIC_M_SECURITY          (SERVICE_BASE + 24)
  352. /* Security Failure. %0 */
  353.  
  354. #define SERVICE_UIC_M_LANROOT           (SERVICE_BASE + 25)
  355. /*
  356.  * Bad or missing LAN Manager root directory.
  357.  */
  358.  
  359. #define SERVICE_UIC_M_REDIR             (SERVICE_BASE + 26)
  360. /*
  361.  * The network software is not installed.
  362.  */
  363.  
  364. #define SERVICE_UIC_M_SERVER            (SERVICE_BASE + 27)
  365. /*
  366.  * The server is not started.
  367.  */
  368.  
  369. #define SERVICE_UIC_M_SEC_FILE_ERR      (SERVICE_BASE + 28)
  370. /*
  371.  * The server cannot access the user accounts database (NET.ACC).
  372.  */
  373.  
  374. #define SERVICE_UIC_M_FILES             (SERVICE_BASE + 29)
  375. /*
  376.  * Incompatible files are installed in the LANMAN tree.
  377.  */
  378.  
  379. #define SERVICE_UIC_M_LOGS              (SERVICE_BASE + 30)
  380. /*
  381.  * The LANMAN\LOGS directory is invalid.
  382.  */
  383.  
  384. #define SERVICE_UIC_M_LANGROUP          (SERVICE_BASE + 31)
  385. /*
  386.  * The domain specified could not be used.
  387.  */
  388.  
  389. #define SERVICE_UIC_M_MSGNAME           (SERVICE_BASE + 32)
  390. /*
  391.  * The computer name is being used as a message alias on another computer.
  392.  */
  393.  
  394. #define SERVICE_UIC_M_ANNOUNCE          (SERVICE_BASE + 33)
  395. /*
  396.  * The announcement of the server name failed.
  397.  */
  398.  
  399. #define SERVICE_UIC_M_UAS               (SERVICE_BASE + 34)
  400. /*
  401.  * The user accounts database is not configured correctly.
  402.  */
  403.  
  404. #define SERVICE_UIC_M_SERVER_SEC_ERR    (SERVICE_BASE + 35)
  405. /*
  406.  * The server is not running with user-level security.
  407.  */
  408.  
  409. #define SERVICE_UIC_M_WKSTA             (SERVICE_BASE + 37)
  410. /*
  411.  * The workstation is not configured properly.
  412.  */
  413.  
  414. #define SERVICE_UIC_M_ERRLOG            (SERVICE_BASE + 38)
  415. /*
  416.  * View your error log for details.
  417.  */
  418.  
  419. #define SERVICE_UIC_M_FILE_UW           (SERVICE_BASE + 39)
  420. /*
  421.  * Unable to write to this file.
  422.  */
  423.  
  424. #define SERVICE_UIC_M_ADDPAK            (SERVICE_BASE + 40)
  425. /*
  426.  * ADDPAK file is corrupted.  Delete LANMAN\NETPROG\ADDPAK.SER
  427.  * and reapply all ADDPAKs.
  428.  */
  429.  
  430. #define SERVICE_UIC_M_LAZY              (SERVICE_BASE + 41)
  431. /*
  432.  * The LM386 server cannot be started because CACHE.EXE is not running.
  433.  */
  434.  
  435. #define SERVICE_UIC_M_UAS_MACHINE_ACCT  (SERVICE_BASE + 42)
  436. /*
  437.  * There is no account for this computer in the security database.
  438.  */
  439.  
  440. #define SERVICE_UIC_M_UAS_SERVERS_NMEMB (SERVICE_BASE + 43)
  441. /*
  442.  * This computer is not a member of the group SERVERS.
  443.  */
  444.  
  445. #define SERVICE_UIC_M_UAS_SERVERS_NOGRP (SERVICE_BASE + 44)
  446. /*
  447.  * The group SERVERS is not present in the local security database.
  448.  */
  449.  
  450. #define SERVICE_UIC_M_UAS_INVALID_ROLE  (SERVICE_BASE + 45)
  451. /*
  452.  * This Windows NT computer is configured as a member of a workgroup, not as
  453.  * a member of a domain. The Netlogon service does not need to run in this
  454.  * configuration.
  455.  */
  456.  
  457. #define SERVICE_UIC_M_NETLOGON_NO_DC    (SERVICE_BASE + 46)
  458. /*
  459.  * The Windows NT domain controller for this domain could not be located.
  460.  */
  461.  
  462. #define SERVICE_UIC_M_NETLOGON_DC_CFLCT (SERVICE_BASE + 47)
  463. /*
  464.  * A primary domain controller is already running in this domain.
  465.  */
  466.  
  467. #define SERVICE_UIC_M_NETLOGON_AUTH     (SERVICE_BASE + 48)
  468. /*
  469.  * The service failed to authenticate with the primary domain controller.
  470.  */
  471.  
  472. #define SERVICE_UIC_M_UAS_PROLOG        (SERVICE_BASE + 49)
  473. /*
  474.  * There is a problem with the security database creation date or serial number.
  475.  */
  476.  
  477.  
  478. #define SERVICE2_BASE    5600
  479. /* new SEVICE_UIC messages go here */
  480.  
  481. #define SERVICE_UIC_M_NETLOGON_MPATH    (SERVICE2_BASE + 0)
  482. /*
  483.  * Could not share the User or Script path.
  484.  */
  485.  
  486. #define SERVICE_UIC_M_LSA_MACHINE_ACCT  (SERVICE2_BASE + 1)
  487. /*
  488.  * The password for this computer is not found in the local security
  489.  * database.
  490.  */
  491.  
  492. #define SERVICE_UIC_M_DATABASE_ERROR    (SERVICE2_BASE + 2)
  493. /*
  494.  * An internal error occurred while accessing the computer's
  495.  * local or network security database.
  496.  */
  497.  
  498.  
  499. //
  500. //  End modifiers
  501. //
  502.  
  503. //
  504. // Commonly used Macros:
  505. //
  506.  
  507. #define SERVICE_IP_CODE(tt,nn) \
  508.   ((long)SERVICE_IP_QUERY_HINT|(long)(nn|(tt<<SERVICE_IP_WAITTIME_SHIFT)))
  509.  
  510. #define SERVICE_CCP_CODE(tt,nn) \
  511.   ((long)SERVICE_CCP_QUERY_HINT|(long)(nn|(tt<<SERVICE_IP_WAITTIME_SHIFT)))
  512.  
  513. #define SERVICE_UIC_CODE(cc,mm) \
  514.   ((long)(((long)cc<<16)|(long)(unsigned short)mm))
  515.  
  516. //
  517. // This macro takes a wait hint (tt) which can have a maximum value of
  518. // 0xFFFF and puts it into the service status code field.
  519. // 0x0FF1FFnn  (where nn is the checkpoint information).
  520. //
  521. #define SERVICE_NT_CCP_CODE(tt,nn)  \
  522.   (  \
  523.     ((long)SERVICE_CCP_QUERY_HINT)   | \
  524.     ((long)(nn))   | \
  525.     (((tt)&LOWER_HINT_MASK) << SERVICE_IP_WAITTIME_SHIFT)   | \
  526.     (((tt)&UPPER_HINT_MASK) << SERVICE_NTIP_WAITTIME_SHIFT)   \
  527.   )
  528.  
  529. //
  530. // This macro takes a status code field, and strips out the wait hint
  531. // from the upper and lower sections.
  532. // 0x0FF1FFnn results in 0x0000FFFF.
  533. //
  534. #define SERVICE_NT_WAIT_GET(code) \
  535.     (   \
  536.       (((code) & UPPER_GET_HINT_MASK) >> SERVICE_NTIP_WAITTIME_SHIFT)  |  \
  537.       (((code) & LOWER_GET_HINT_MASK) >> SERVICE_IP_WAITTIME_SHIFT)  \
  538.     )
  539.  
  540. #ifdef __cplusplus
  541. }
  542. #endif
  543.  
  544. #pragma option pop
  545. #endif // _LMSVC_
  546.